import Vue from 'vue'
import Vuex from 'vuex'
import config from "../plugins/config";
Vue.use(Vuex)

// window.fetch() 的 Polyfill

const store = () => new Vuex.Store({


  state: {
    authUser: null,
    counter: 0,
    api: config.api
  },

  mutations: {
    login: function (state, user) {
      state.authUser = user
    },
    loginOut: function (state) {
      state.authUser = null
    }
  }

})

export default store